<?php
namespace app\miniprogram\controller;

/**
 * 商户接口
 */
class StoreGroup extends Base
{
    protected $process = 'StoreInfo';
    protected $noNeedLogin = ['look'];

    //获取所有店铺地址
    public function list() {
        $this->ajax_process(function($process) {
            return $process->list();
        });
    }

    //获取店铺直接信息
    public function info() {
        $this->ajax_process(function($process, $user) {
            return $process->info($user);
        });
    }

    //获取店铺完整信息
    public function preview_look() {
        $this->ajax_process(function($process, $user) {
            return $process->preview_look($user);
        });
    }

    //保存店铺
    public function save() {
        $this->ajax_process(function($process, $user) {
            return $process->save($user);
        });
    }

    //用户获取自己的基础信息
    public function user_info() {
        $this->ajax_process(function($process, $user) {
            return $process->user_info($user);
        });
    }

    //用户获取自己的店铺完成信息
    public function user_look() {
        $ewm = $this->request->param('ewm');
        $this->ajax_process(function($process, $user) use ($ewm) {
            $args = $process->user_look($user);
            if($ewm && $args['row']) {
                $args['row']->append(['back_ewm']);
            }
            return $args;
        });
    }

    //查看店铺基础信息
    public function look() {
        $this->ajax_process(function($process, $user) {
            return $process->look();
        });
    }

    //查看店铺信息
    public function look_all() {
        $this->ajax_process(function($process, $user) {
            return $process->look_all();
        });
    }

    //店铺开张
    public function show() {
        $this->ajax_process(function($process, $user) {
            return $process->show($user);
        });
    }

    //店铺关门
    public function hide() {
        $this->ajax_process(function($process, $user) {
            return $process->hide($user);
        });
    }

    //店铺进入扫脸审核状态
    public function examine2saolianshenhe() {
        $this->ajax_process(function($process, $user) {
            return $process->examine2saolianshenhe($user);
        });
    }

    //我推广的商家
    public function spread_store() {
        $this->ajax_process(function($process, $user) {
            return $process->spread_store($user);
        });
    }
}
